<template>
  <div class="more-container">
    <div class="map-box">
      显示地图：
      <van-switch v-model="show" @change="handleChange" />
    </div>
  </div>
</template>

<script>
  import Vue from 'vue'
  import { mapActions, mapState } from 'vuex'
  import { TOGGLE_VISIBLE } from '@/store/action-types'

  import { Switch } from 'vant'
  Vue.use(Switch)

  export default {
    data() {
      return {
        show: this.showMap
      }
    },
    computed: {
      ...mapState(['showMap']),
    },

    methods: {
      ...mapActions([TOGGLE_VISIBLE]),
      handleChange(value) {
        this[TOGGLE_VISIBLE](value)
      }
    }
  }
</script>

<style lang="scss" scoped>
.more-container {
  padding: .2rem;
  .map-box {
    display: flex;
    align-items: center;
  }
}
</style>